Next: Term Mode, Previous: Shell Options, Up: Shell [Contents][Index]
To run a subshell in a text terminal emulator, use M-x term. This creates (or reuses) a buffer named *terminal*, and runs a subshell with input coming from your keyboard, and output going to that buffer.
The terminal emulator uses Term mode, which has two input modes. In line mode, Term basically acts like Shell mode (see Shell Mode). In char mode, each character is sent directly to the subshell, as terminal input; the sole exception is the terminal escape character, which by default is C-c (see Term Mode). Any echoing of your input is the responsibility of the subshell; any terminal output from the subshell goes into the buffer, advancing point.
Some programs (such as Emacs itself) need to control the
appearance of the terminal screen in detail. They do this by
emitting special control codes. Term mode recognizes and handles
ANSI-standard VT100-style escape sequences, which are accepted by
most modern terminals, including xterm. (Hence, you
can actually run Emacs inside an Emacs Term window.)
The term face specifies the default appearance of
text in the terminal emulator (the default is the same appearance
as the default face). When terminal control codes
are used to change the appearance of text, these are represented
in the terminal emulator by the faces
term-color-black, term-color-red,
term-color-green, term-color-yellow
term-color-blue, term-color-magenta,
term-color-cyan, term-color-white,
term-color-underline, and
term-color-bold. See Faces.
You can also Term mode to communicate with a device connected to a serial port. See Serial Terminal.
The file name used to load the subshell is determined the same way as for Shell mode. To make multiple terminal emulators, rename the buffer *terminal* to something different using M-x rename-uniquely, just as with Shell mode.
Unlike Shell mode, Term mode does not track the current
directory by examining your input. But some shells can tell Term
what the current directory is. This is done automatically by
bash version 1.15 and later.
Next: Term Mode, Previous: Shell Options, Up: Shell [Contents][Index]